package com.simple.mapper;

import com.simple.pojo.Bank;
import com.simple.pojo.Income;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface IncomeMapper extends Mapper<Income> {

    @Delete("<script> delete from tb_income where id in " +
            "<foreach collection='ids' item='id' open='(' separator=',' close=')' >" +
            "#{id}" +
            "</foreach>" +
            "</script>")
    void deleteByIds(@Param("ids") List<Integer> ids);

    @Select("select * from tb_income where user_id = #{userId} order by create_time desc")
    List<Income> getIncomes(Integer userId);

}